﻿using MediatR;
using T_Person.BaseRep.Interface;
using T_Person.Domain;
using T_Person.Read.APi.Applaction.Command.Employment;

namespace T_Person.Read.APi.Applaction.CommandHandlers.PersonnelHandlers
{
    public class EmployeementSearchByIdHandlers : IRequestHandler<EmploymentSearchByidCommand, Personnel>
    {
        private readonly IPersonnelRep personnelRep;

        public EmployeementSearchByIdHandlers(IPersonnelRep personnelRep)
        {
            this.personnelRep = personnelRep;
        }

        public async Task<Personnel> Handle(EmploymentSearchByidCommand request, CancellationToken cancellationToken)
        {
            var list = await personnelRep.GetAloneByid(request.id);
            return await Task.FromResult(list);
        }
    }
}
